  // Displays GCS/ShoppingAPI response as ATOM in Chrome without 
  // Chrome's "Feed intent viewer"
  // To use:  Download, then in Chrome  click settings-> chrome extensions--> enable debug mode
  // Install extension by selecting the folder 'view_gcs'


var requestFilter = {
    urls: [ "https://www.googleapis.com/*"]
};


chrome.webRequest.onHeadersReceived.addListener(
  function(details) {
    var headers = details.responseHeaders,
        blockingResponse = {};

    for( var i = 0, l = headers.length; i < l; ++i ) {
      if( (headers[i].name.toLowerCase() == 'content-type') &&  (headers[i].value.toLowerCase() == 'application/atom+xml; charset=utf-8')) {
        headers[i].value = 'text/xml';
        break;
      }
    }
    blockingResponse.responseHeaders = headers;
    return blockingResponse;
  },
  // filters
 requestFilter,
 ["blocking", "responseHeaders"]);
